package org.hackystat.linkedservicedata.ui.projects;

import java.util.HashMap;
import java.util.LinkedList;
import org.hackystat.linkedservicedata.vocabularies.HackystatVocab;

/**
 * Utility class to group all the components used to construct a project profile.
 *
 * @author Myriam Leggieri.
 *
 */
public class ProjectProfile {

  public String visibility = null;

  public String owner = null;

  public String name = null;

  public String description = null;

  public String repository = null;

  public String repositoryType = null;

  public String repositoryAnonymous = null;

  public String repositoryWebBrowserInterface = null;

  public String startDate = null;

  public String endDate = null;

  public String modifiedDate = null;

  private LinkedList<String[]> membersRole = null;

  private LinkedList<String> wikis = null;

  private LinkedList<String> mirrors = null;

  private LinkedList<String> progrLangs = null;

  private LinkedList<String> operatingSystems = null;

  private LinkedList<String> bugDBs = null;

  private LinkedList<String> sameAs = null;

  private LinkedList<String> seeAlso = null;

  private LinkedList<String> tags = null;

  private LinkedList<String> tools = null;

  private LinkedList<String> devPhases = null;

  private HashMap<String, String> skills = new HashMap<String, String>();

  public ProjectProfile() {
    resetSkills();
    resetMembersRole();
    resetWikis();
    resetSameAs();
    resetSeeAlso();
    resetTags();
    resetTools();
    resetDevPhases();
    resetMirrors();
    resetProgrLangs();
    resetOS();
    resetBugDB();
  }

  public void resetSkills() {
    skills = new HashMap<String, String>();
  }

  public HashMap<String, String> getSkills() {
    return skills;
  }

  public void setDevelopmentTime(String developmentTime) {
    String key = HackystatVocab.DEVELOPMENT_TIME.getLocalName();
    skills.put(key, developmentTime);
  }

  public void setBuildQuality(String buildQuality) {
    String key = HackystatVocab.BUILD_QUALITY.getLocalName();

    skills.put(key, buildQuality);
  }

  public void setUnitTestQuality(String quality) {
    String key = HackystatVocab.UNIT_TEST_QUALITY.getLocalName();
    skills.put(key, quality);
  }

  public void setCoverageQuality(String quality) {
    String key = HackystatVocab.COVERAGE_QUALITY.getLocalName();
    skills.put(key, quality);
  }

  public void setAmountOfIssues(String amountOfIssues) {
    String key = HackystatVocab.AMOUNT_OF_CODE_ISSUES.getLocalName();
    skills.put(key, amountOfIssues);
  }

  public void setCommitFrequency(String commitFrequency) {
    String key = HackystatVocab.COMMIT_FREQUENCY.getLocalName();
    skills.put(key, commitFrequency);
  }

  private void resetDevPhases() {
    this.devPhases = new LinkedList<String>();
  }

  private void resetTools() {
    this.tools = new LinkedList<String>();
  }

  private void resetBugDB() {
    this.bugDBs = new LinkedList<String>();
  }

  private void resetOS() {
    this.operatingSystems = new LinkedList<String>();
  }

  private void resetProgrLangs() {
    this.progrLangs = new LinkedList<String>();
  }

  private void resetMirrors() {
    this.mirrors = new LinkedList<String>();
  }

  public void addMirrors(String uri) {
    mirrors.add(uri);
  }

  public void addOS(String uri) {
    operatingSystems.add(uri);
  }

  public void addTool(String uri) {
    tools.add(uri);
  }

  public void addDevelopmentPhase(String uri) {
    devPhases.add(uri);
  }

  public void addProgrLangs(String uri) {
    progrLangs.add(uri);
  }

  public void addBugDB(String uri) {
    bugDBs.add(uri);
  }

  public void resetWikis() {
    wikis = new LinkedList<String>();
  }

  public void resetMembersRole() {
    membersRole = new LinkedList<String[]>();
  }

  public void resetSameAs() {
    sameAs = new LinkedList<String>();
  }

  public void resetSeeAlso() {
    seeAlso = new LinkedList<String>();
  }

  public void resetTags() {
    tags = new LinkedList<String>();
  }

  public void addWikis(String uri) {
    wikis.add(uri);
  }

  public void addMembersRole(String member, String role) {
    membersRole.add(new String[] { member, role });
  }

  public void addSameAs(String uri) {
    sameAs.add(uri);
  }

  public void addSeeAlso(String uri) {
    seeAlso.add(uri);
  }

  public void addTag(String uri) {
    tags.add(uri);
  }

  public LinkedList<String> getWikis() {
    return wikis;
  }

  public LinkedList<String[]> getMembersRole() {
    return membersRole;
  }

  public LinkedList<String> getSameAs() {
    return sameAs;
  }

  public LinkedList<String> getSeeAlso() {
    return seeAlso;
  }

  public LinkedList<String> getTags() {
    return tags;
  }

  public LinkedList<String> getMirrors() {
    return mirrors;
  }

  public LinkedList<String> getBugDBs() {
    return bugDBs;
  }

  public LinkedList<String> getProgrLangs() {
    return progrLangs;
  }

  public LinkedList<String> getOperatingSystems() {
    return operatingSystems;
  }

  public LinkedList<String> getTools() {
    return tools;
  }

  public LinkedList<String> getDevelopmentPhases() {
    return devPhases;
  }

}
